package com.zxy.ziems.server.statistics.service.impl;

import com.zxy.ziems.server.classify.pojo.entity.Classify;
import com.zxy.ziems.server.classify.pojo.entity.ClassifyDeviceProperty;
import com.zxy.ziems.server.classify.service.ClassifyService;
import com.zxy.ziems.server.constant.enums.DictCodeEnum;
import com.zxy.ziems.server.domain.DictItem;
import com.zxy.ziems.server.dto.DateDto;
import com.zxy.ziems.server.energy.pojo.dto.DeviceMeasureDateDTO;
import com.zxy.ziems.server.service.DictItemService;
import com.zxy.ziems.server.statistics.pojo.vo.ChartMultiVo;
import com.zxy.ziems.server.statistics.service.WaterService;
import com.zxy.ziems.server.utils.DateUtils;
import com.zxy.ziems.server.vo.ChartVo;
import com.zxy.ziems.server.vo.ChartYAxisVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class WaterServiceImpl implements WaterService {

    @Autowired
    private DictItemService dictItemService;
    @Autowired
    private ClassifyService classifyService;

    private ChartVo buildEmpty(String queryType, List<LocalDateTime> list, String classifyName) {
        //根据查询类型格式化x轴信息
        List<String> xAxisList = DateUtils.xAxisConvert(queryType, list);
        ChartYAxisVo chartYAxisVo = new ChartYAxisVo();
        chartYAxisVo.setName(classifyName);
        chartYAxisVo.setType("line");
        List<BigDecimal> dataValueList = new ArrayList<>();

        xAxisList.forEach((d) -> dataValueList.add(BigDecimal.ZERO));

        chartYAxisVo.setData(dataValueList);
        ChartVo chartVo = new ChartVo();
        chartVo.setXAxisList(xAxisList);
        chartVo.setYAxisList(List.of(chartYAxisVo));
        return chartVo;
    }
}
